//
//  StoryMakeFooterFilterCell.m
//  GetZSCStoryMaker
//
//  Created by whbalzac on 11/08/2017.
//  Copyright © 2017 makeupopular.com. All rights reserved.
//

#import "StoryMakeFooterFilterCell.h"

@implementation StoryMakeFooterFilterCell

#pragma mark - Class Methods
+ (NSString *)identifierForReuseCell {
    return NSStringFromClass([self class]);
}

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self configureView];
    }
    return self;
}

- (void)configureView
{
    [self.contentView addSubview:self.imageView];

    [self.imageView setFrame:CGRectMake(0, 8, self.contentView.frame.size.width, self.contentView.frame.size.width)];
    
    [self.contentView addSubview:self.filterNameLabel];

    [self.filterNameLabel setFrame:CGRectMake(0, CGRectGetMaxY(self.imageView.frame) + 5, self.contentView.frame.size.width, 15)];
}

- (void)setSelected:(BOOL)selected {
    if (selected) {
        self.imageView.layer.borderColor = ThemeColor.CGColor;
        self.filterNameLabel.textColor = ThemeColor;
    } else {
        self.imageView.layer.borderColor = ViewBackgroundColor.CGColor;
        self.filterNameLabel.textColor = TextColor;
    }
}

#pragma mark -
#pragma mark - Getter

- (UIImageView *)imageView
{
    if (!_imageView) {
        _imageView = [[UIImageView alloc] init];
        _imageView.contentMode = UIViewContentModeScaleAspectFill;
        _imageView.layer.masksToBounds = YES;
        _imageView.layer.cornerRadius = 8;
        _imageView.layer.borderWidth = 2;
        _imageView.layer.borderColor = ViewBackgroundColor.CGColor;
    }
    return _imageView;
}

- (UILabel *)filterNameLabel
{
    if (!_filterNameLabel){
        _filterNameLabel = [[UILabel alloc] init];
        _filterNameLabel.textColor = TextColor;
        _filterNameLabel.textAlignment = NSTextAlignmentCenter;
        _filterNameLabel.font = [UIFont systemFontOfSize:12.0];
        _filterNameLabel.adjustsFontSizeToFitWidth = YES;
    }
    return _filterNameLabel;
}

@end
